using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;


public class Toggle_AppLeftMenu : MonoBehaviour
{
    public Ui_popup target;
    public void Start()
    {
        var toggle = transform.GetComponent<ToggleBtn>();
        toggle.onValueChanged.AddListener(OnValueChanged);
        target.Init();
        ChangeStatus(toggle.isOn);
    }

    private void OnValueChanged(bool isOn)
    {
        ChangeStatus(isOn);
    }

    private void ChangeStatus(bool isOn)
    {
        if (isOn)
            target.PopUp();
        else
            target.Hide();
    }
}
